package utils

import "strconv"

func Uint32ToPtr(val uint32) *uint32 { return &val }
func StrToInt(val string) int {
	i, err := strconv.Atoi(val)
	if err != nil {
		return 1
	}
	return i
}
func BoolToPtr(val bool) *bool { return &val }

func BaseTypeToPtr[T any](val T) *T { // int, string, bool, float64,
	return &val
}

func ConvStrToUint16(str string) uint16 {
	val, err := strconv.ParseUint(str, 10, 16)
	if err != nil {
		return 0
	}
	return uint16(val)
}
